1 Rasters

1.1 Downloading raster climate data

Worldclim database http://worldclim.org/version2

## [1] "RasterStack"
## attr(,"package")
## [1] "raster"
## class       : RasterLayer 
## dimensions  : 900, 2160, 1944000  (nrow, ncol, ncell)
## resolution  : 0.1666667, 0.1666667  (x, y)
## extent      : -180, 180, -60, 90  (xmin, xmax, ymin, ymax)
## coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
## data source : in memory
## names       : bio1 
## values      : -26.9, 31.4  (min, max)

Source: National Ecological Observatory Network (NEON)
Source: National Ecological Observatory Network (NEON)

1.2 What is a raster?

“Gridded” data that represents areas on the Earth’s surface as pixels.

Source: National Ecological Observatory Network (NEON)
Source: National Ecological Observatory Network (NEON)

1.3 Exploring a raster

1.3.1 Spatial resolution

The size of each cell in meters

Source: National Ecological Observatory Network (NEON)
Source: National Ecological Observatory Network (NEON)

1.3.2 Spatial extent

X, Y coordinates of the corners of the raster in the geographic space

Source: National Ecological Observatory Network (NEON)
Source: National Ecological Observatory Network (NEON)

1.3.3 Coordinate Reference System & Projection Information

The projection of a dataset refers to the way the data are “flattened” in into a 2D space. The coordinate system references the x and y coordinate space that is associated with the projection.

“If you have the same dataset saved in two different projections, these two files won’t line up correctly”

Source: M. Corey, opennews.org
Source: M. Corey, opennews.org

1.4 Plotting raster

1.4.1 Changing breaks and colours

## $breaks
## [1] -40 -20   0  20  40
## 
## $counts
## [1]  11693 181932 203695 187201
## 
## $density
## [1] 0.001000221 0.015562486 0.017424096 0.016013197
## 
## $mids
## [1] -30 -10  10  30
## 
## $xname
## [1] "v"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"

1.4.2 Challenge!

Using the annual mean precipitation raster, create a plot that customises the color map with 5 breaks.

1.4.3 Cropping Rasters

1.5 Challenge!

Create a precipitation and temperature plot of Australia

1.6 Raster calculations